export default{
    // 统计购物车数量
    totalCount(state){
        return state.cartfoods.reduce((pretotal,food)=>{
            return pretotal+food.count
        },0)
    },
    // 统计价格
    totalPrice(state){
        return state.cartfoods.reduce((pretotal,food)=>{
           return pretotal+food.count*food.price
        },0)
    },
    // 满意的评价
    getGoodRating(state){
        return state.ratings.reduce((pretotal,rating)=>{
            return pretotal+(rating.rateType==0 ? 1 : 0)
        },0)
    }
}